"""
简易计算器

用户按提示输入两个数字和一个运算符，程序返回结果
"""

class Calculator:

    def __init__(self, num1, num2):
        self.num1 = num1
        self.num2 = num2

    def add(self):
        return self.num1 + self.num2

    def sub(self):
        return self.num1 - self.num2

    def mul(self):
        return self.num1 * self.num2

    def divi(self):
        if self.num2 == 0:
            return "错误，除数不能为0！"
        return self.num1 / self.num2

if __name__ == '__main__':

    num1 = float(input("请输入第一个数字"))
    symbol = input("请输入运算符")
    num2 = float(input("请输入第二个数字"))

    calc = Calculator(num1, num2)

    result = None
    if symbol == '+':
        result = calc.add()
    elif symbol == '-':
        result = calc.sub()
    elif symbol == '*':
        result = calc.mul()
    elif symbol == '/':
        result = calc.divi()
    else:
        print("运算符错误")

    print(result)